{layout name="admin:layout" /}
<div class="tipbox tipbox-message">
    <span class="fn-fb">友情提示:</span>
    <p class="gray">
        1、请打开微信公众号平台,网址:<a href="https://mp.weixin.qq.com" target="_blank">https://mp.weixin.qq.com</a>,申请公众号<span class="red">必须是服务号</span>。<br /> 
        2、登录->开发->基本配置->服务器配置(已启用)<br /> 
        3、帐号详情->功能设置->填写相关授权域名：(域名：<span class="red">{$Request.host}</span>)<br />     
        4、设置正确后,前台会员支持扫码关注公众号登录管理。
    </p>
</div>
{layout name="admin:layout" /}
<form id="form" action="{:url('system/admin.setting/wechatAccount')}">
<table class="formtable">
    <tr><th class="w150">服务器地址(URL):</th><td>{:url('system/event.wechatAccount/index',['appid' => $info.app_id?$info.app_id:'$APPID$'],true,true)}</td></tr>
    <tr><th class="w150">开启扫码:</th>
        <td>
            <label>关闭</label> <input class="radio" type="radio" name="qrcode_login"" value="0" {$info.qrcode_login?'':'checked'}/> 
            <label>开启</label><input class="radio" type="radio" name="qrcode_login" value="1"  {$info.qrcode_login?'checked':''}/>
        </td>
    </tr>
    <tr><th>AppID(公众号):</th><td><input class="input w160" datatype="*" type="text" name="app_id" value="{$info.app_id?$info.app_id:''}" /> <span class="gray pl5">把服务器地址(URL)中$APPID$替换为你的AppID</span></td></tr>
    <tr><th>AppSecret(公众号):</th><td class="input-group"><input id="mp_secret" class="input w400" datatype="*" type="text" name="secret" value="{$info.secret?$info.secret:''}" /><button type="button" class="mp_create button ">随机生成</button> </td></tr>
    <tr><th>Token(公众号):</th>
        <td class="input-group">
            <input id="mp_token" class="input w400" datatype="*" type="text" name="token" value="{$info.token?$info.token:''}" />
            <button type="button" class="mp_token button">随机生成</button> <br />
            <span class="gray">Token必须为英文或数字，长度为3-32字符。如不填写则默认为“TOKEN”。</span>
        </td>
    </tr>
    <tr>
        <th>EncodingAESKey:</th>
        <td class="input-group"><input id="mp_aes_key" class="input w400" datatype="*" type="text" name="aes_key" value="{$info.aes_key?$info.aes_key:''}" /><button type="button" class="mp_aes_key button">随机生成</button><br />
            <span class="gray">公众号消息加密密钥由43位字符组成，可随机修改，字符范围为A-Z，a-z，0-9。</span>
        </td>
    </tr> 
    <tr>
        <td></td>
        <td class="input-group">
            <input type="submit" value="确定" class="button button-blue submit" />
            <input type="reset" value="重置" class="button button-blank" />
        </td>
    </tr>
</table>
</form>
<script type="text/javascript">
Do('base','layer','form','color',function () {
    $('#form').isForm();
    $('.mp_create').click(function(){
        $('#mp_secret').val(randomWord(32,32,32))
    })
    $('.mp_create').click(function(){
        $('#mp_secret').val(randomWord(32,32,32))
    })
    $('.mp_token').click(function(){
        $('#mp_token').val(randomWord(30,30,30))
    }) 
    $('.mp_aes_key').click(function(){
        $('#mp_aes_key').val(randomWord(43,43,43))
    })
});
</script>